$(function(){
	setSize();
	$(window).resize(setSize);
	getUser();
	getTimeNow();
});

function setSize() {
	var h = $(window).height();
	$('.content').css('min-height', (h - 198) + 'px');
}

function changeHeaderMenu(id) {
	$('#hd_header_menu .item:eq(' + id + ')').addClass('sel');
}

/**
 * 初始化用户信息
 */
function getUser(){
	$('#hd_header .heading_user').html(heading.userName);
	$('#hd_header .deviceBindCode').html(heading.deviceBindCode);
}

/**
 * 显示当前时间
 */
function getTimeNow() {
	var d = new Date();
	var year = d.getFullYear();
	var month = d.getMonth();
	month += 1;
	var date = d.getDate();
	var hours = d.getHours();
	var minutes = d.getMinutes();
	var seconds = d.getSeconds();
	if(month < 10)
		month = '0' + month;
	if(date < 10)
		date = '0' + date;
	if(hours < 10)
		hours = '0' + hours;
	if(minutes < 10)
		minutes = '0' + minutes;
	if(seconds < 10)
		seconds = '0' + seconds;
	var t = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;
	$('.time_now_div').html(t);
	setTimeout(getTimeNow, 500);
}
